---
title: "Prevalence of Anxiety Disorders in Latin America: A Systematic Review and Meta-Analysis"
author: "Alvaro Passi-Solar"
date: "2024-10-14"
output:
  html_document:
    df_print: paged
---


```{r, include=F}
rm(list=ls())
tictoc::tic(msg="total")
library(tidyverse)

```


# 1- Prepare data 

```{r, include=FALSE}

rmarkdown::render("1 - Preparation_base_SR.Rmd",
                  output_file=paste0("Render/1 - Preparation_base_SR",".docx"))
```

[1] "SoP4"
|....................................................                                            |  55% (unnamed-chunk-30)Error: Optimizer (nlminb) did not achieve convergence (convergence = 1).




# 2.1 - Meta-analysis: all studies

```{r}
# to store rural - urban setting  results

columns <- c("contrast", "nullvalue", "estimate", "stderror", 
             "statistic", "pvalue", "adjusment", "adjpvalue", 
             "subgroup", "condx")

df <- data.frame(matrix("", nrow = 1, ncol = length(columns)))
colnames(df) <- columns
write.csv(df, "Render/2 - t_t_setting.csv", row.names = FALSE)
```

```{r}
diagx<-c(
  "AG1", 
  "AG2",
  "AG4",
  "ANY1", "ANY2", "ANY4",
  "GAD1", "GAD2",
  "GAD4",
  "OCD1", "OCD2", "OCD4", "PD1", "PD2", "PD4",
  "SoP1", "SoP2",
  "SoP4",
  "SP1", "SP2", "SP4",
  "PTSD1", "PTSD2",
  "PTSD4"
)
```

```{r, include=FALSE}
# diagx<-c( "SP1", "SP2", "SP4")
tictoc::tic()

birtcohortx<-""


for(i in 1:length(diagx)){
  condx<-diagx[i]
  print(condx)
  
  rmarkdown::render("2 - Meta_torender.Rmd",
                    output_file=paste0("Render/2 - ",condx,".docx"))
  
}
tictoc::toc(log=T)
```

# 2.2 - Meta-analysis - Birthcohorts


```{r, include=FALSE}
# diagx<-c( "SP1", "SP2", "SP4")
birtcohortx<-"_birtcohort"
tictoc::tic()



for(i in 1:length(diagx)){
  condx<-diagx[i]
  print(condx)
  
  rmarkdown::render("2 - Meta_torender.Rmd",
                    output_file=paste0("Render/2 - ",condx,"_birthcohorts.docx"))
}
tictoc::toc(log=T)
```

# 3 - Any_methods2.Rmd


```{r, include=FALSE}
rmarkdown::render("3 - Any_methods.Rmd",
                  output_file=paste0("Render/3 - ","anyx",".docx"))



```


# 4.1 - PTSD methods: All studies
```{r, include=FALSE}
birtcohortx<-""

rmarkdown::render("4 - PTSD_methods.Rmd",
                  output_file=paste0("Render/4 - ","PTSDx",".docx"))
```


# 4.2 - PTSD methods: _birtcohort

```{r, include=FALSE}
birtcohortx<-"_birtcohort"

rmarkdown::render("4 - PTSD_methods.Rmd",
                  output_file=paste0("Render/4 - ","PTSDx_birtcohort",".docx"))
```


```{r}
tictoc::toc(log=T)

```
